/* 通用样式 */
body {
    font-family: 'Segoe UI', 'Microsoft YaHei', sans-serif;
    background-color: #f4f7f6;
    margin: 0;
    padding: 20px;
    display: flex;
    justify-content: center;
    align-items: flex-start; /* 顶部对齐 */
    min-height: 100vh;
}

.container {
    background-color: #ffffff;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    width: 100%;
    max-width: 800px; /* 限制最大宽度 */
    box-sizing: border-box;
}

h1 {
    text-align: center;
    color: #333;
    margin-bottom: 30px;
    font-size: 2.2em;
    font-weight: 600;
    border-bottom: 2px solid #eee;
    padding-bottom: 15px;
}

/* 表单组样式 */
.form-group {
    margin-bottom: 25px;
}

.form-group label {
    display: block;
    margin-bottom: 8px;
    color: #555;
    font-weight: 600;
    font-size: 1.1em;
}

.form-group input[type="text"],
.form-group input[type="number"],
.form-group textarea {
    width: 100%;
    padding: 12px 15px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 1em;
    color: #333;
    box-sizing: border-box; /* 包含padding和border在宽度内 */
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

.form-group input[type="text"]:focus,
.form-group input[type="number"]:focus,
.form-group textarea:focus {
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0, 123, 255, 0.25);
    outline: none;
}

.form-group textarea {
    resize: vertical; /* 允许垂直调整大小 */
    min-height: 100px;
}

/* 行内表单组（单价、特价） */
.inline-group {
    display: flex;
    gap: 20px; /* 元素之间的间距 */
}

.inline-group .input-half {
    flex: 1; /* 均分可用空间 */
}

/* 图片上传区域样式 */
.image-upload-area {
    border: 2px dashed #a0a0a0;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    background-color: #fafafa;
    cursor: pointer;
    transition: background-color 0.3s ease, border-color 0.3s ease;
    position: relative; /* 用于放置绝对定位的input file */
}

.image-upload-area:hover {
    background-color: #e9e9e9;
    border-color: #007bff;
}

.image-upload-area input[type="file"] {
    position: absolute; /* 使其覆盖整个区域但不可见 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    opacity: 0; /* 完全透明 */
    cursor: pointer;
    z-index: 10;
}

.image-upload-area .help-text {
    color: #777;
    font-size: 0.9em;
    margin-top: 10px;
}

.image-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 20px;
    justify-content: center;
    min-height: 80px; /* 保证有一定高度 */
    border: 1px solid #eee;
    padding: 10px;
    border-radius: 5px;
    background-color: #fff;
    align-items: center;
}

.image-preview .placeholder {
    color: #bbb;
    font-style: italic;
    font-size: 0.9em;
}

.image-preview img {
    width: 80px;
    height: 80px;
    object-fit: cover; /* 裁剪图片以适应容器 */
    border: 1px solid #ddd;
    border-radius: 5px;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
}

/* 按钮样式 */
.form-actions {
    text-align: right;
    margin-top: 30px;
    border-top: 1px solid #eee;
    padding-top: 25px;
}

.form-actions button {
    padding: 12px 25px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1.1em;
    font-weight: 500;
    transition: background-color 0.3s ease, transform 0.2s ease;
}

.submit-btn {
    background-color: #28a745;
    color: white;
    margin-left: 15px;
}

.submit-btn:hover {
    background-color: #218838;
    transform: translateY(-2px);
}

.reset-btn {
    background-color: #6c757d;
    color: white;
}

.reset-btn:hover {
    background-color: #5a6268;
    transform: translateY(-2px);
}

/* 响应式设计 */
@media (max-width: 600px) {
    .container {
        padding: 25px;
        margin: 10px;
    }

    h1 {
        font-size: 1.8em;
    }

    .form-group label {
        font-size: 1em;
    }

    .inline-group {
        flex-direction: column; /* 小屏幕上垂直堆叠 */
        gap: 15px;
    }

    .form-actions {
        text-align: center;
    }

    .form-actions button {
        display: block;
        width: 100%;
        margin-bottom: 15px;
        margin-left: 0; /* 移除左侧边距 */
    }

    .form-actions button:last-child {
        margin-bottom: 0;
    }
}
